package Logic;
import java.util.List;
import Dao.CardDAO;
import Model.CardBean;

public class CardLogic{
    // 根据ID获取卡信息
    public List<CardBean> getCard(int CardID){
        List<CardBean> result = null;
        try{
            CardDAO carddAO = new CardDAO();
            result = carddAO.getCard(CardID);
        }catch (Exception e){
            e.getMessage();
            result = null;
        }
        return result;
    }
 
    // 根据卡名获取卡信息
    public List<CardBean> getCardByName(String CardName){
        List<CardBean> result = null;
        try{
            CardDAO carddAO = new CardDAO();
            result = carddAO.getCardByName(CardName);
        }catch (Exception e){
            e.getMessage();
            result = null;
        }
        return result;
    }
    // 添加新卡类型
    public boolean addCard(CardBean card){
        boolean result = false;
        try{
        	CardDAO carddao = new CardDAO();
        	carddao.addCard(card);
            result = true;
        }catch (Exception e){
            e.getMessage();
            result = false;
        }
        return result;
    }
    
    
    
}
